﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="IndexArt.aspx.cs" Inherits="MusicSite.Views.Content.Artist.IndexArt" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Artist's list
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form id="formArtist" runat="server">
<div>
    <h2>All Artists</h2>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            SelectMethod="GetArtistsByName" 
            TypeName="Model.ArtistProvider" 
            UpdateMethod="UpdateArtist" 
            DeleteMethod="DeleteArtist"
            DataObjectTypeName="Model.Entities.ArtistDetails" >
        <DeleteParameters>
            <asp:Parameter Name="artistId" Type="Int32" />
        </DeleteParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="Filtr" Name="artName" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

</div>
<div>
    <p>
        <asp:Label ID="Error" CssClass="error" runat="server" Text="***Enter artist's name please!"></asp:Label>
    </p>
    <p>
        <asp:Label ID="ErrorDescr" CssClass="error" runat="server" Text="***Enter description please!"></asp:Label>
    </p>
</div>
<div>
    <fieldset>
        <legend>Search</legend>
        <table>
            <tr>
                <td>Artist's name:</td>
                <td><asp:TextBox ID="Filtr" runat="server"></asp:TextBox></td>
            </tr>
        </table>
        <input type="submit" value="Search" />
    </fieldset>
</div>
<div>
    <asp:GridView ID="GridView1" runat="server" CssClass="index" AllowPaging="True" 
        AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" DataKeyNames="ArtistId"
        onrowediting="GridView1_RowEditing" onrowupdating="GridView1_RowUpdating" >
        <Columns>
            <asp:HyperLinkField Text="Edit" DataNavigateUrlFields="ArtistId" HeaderStyle-Width="30px"
                DataNavigateUrlFormatString="~/Views/Content/Artist/EditArt.aspx?artistId={0}">
            </asp:HyperLinkField>
            <asp:BoundField DataField="ArtistId" HeaderText="ArtistId" 
                SortExpression="ArtistId" Visible="false" >
            </asp:BoundField>
            <asp:BoundField DataField="ArtistName" HeaderText="Artist name" HeaderStyle-Width="200px"
                SortExpression="ArtistName" >
            </asp:BoundField>
            <asp:BoundField DataField="FoundationDate" HeaderText="Foundation date" HeaderStyle-Width="100px"
                DataFormatString="{0:dd-MM-yyyy}" >
            </asp:BoundField>
            <asp:imagefield  DataImageUrlField="Photo" DataImageUrlFormatString="~/Content/images/{0}" 
                NullImageUrl="~/Content/images/noimage.gif" headertext="Photo" 
                ControlStyle-CssClass="photo" HeaderStyle-Width="100px">
            </asp:imagefield>
            <asp:BoundField DataField="Description" HeaderText="Description"
                SortExpression="Description" >
            </asp:BoundField>
        </Columns>
    </asp:GridView>
</div>
</form>
<p>
    <asp:HyperLink ID="hyperLink1" runat="server" Text="Create new" 
        NavigateUrl="~/Views/Content/Artist/EditArt.aspx"></asp:HyperLink>
</p>
</asp:Content>
